package app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.security.Principal;

/**
 * Created by Administrator on 2016/11/18.
 */
@SpringBootApplication
@EnableResourceServer
@Controller
@Import(value={config.AuthConfiguration.class,config.WebSecurityConfig.class,data.config.DataBaseConfiguration.class})
public class AuthServerApplication {


    public static void main(String[] args){
        SpringApplication.run(AuthServerApplication.class);
    }

    @RequestMapping("/user")
    @ResponseBody
    public Principal user(Principal user) {
        System.out.println("---------------" + user.getName());
        return user;
    }

}
